Add FTS5 project search with dual-backend indexing#21
Merged
heiko-braun merged 6 commits intomainfrom Mar 14, 2026
Merged
Conversation
Implement full-text search over the project tree using SQLite FTS5 with two backends: porter-stemmed for natural language and trigram for substring matching. Includes incremental indexing (mtime fast-path + xxh3 hashing), query classification/routing, BM25 score merging, and CLI commands (draft index, draft search). Integrates into /spec, /refine, and /implement skills for automatic indexing and context retrieval. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
mattn/go-sqlite3 requires CGO_ENABLED=1 and a C compiler, which breaks cross-compilation in goreleaser (CGO_ENABLED=0). modernc.org/sqlite is a pure-Go SQLite implementation that includes FTS5 by default and needs no build tags or CGo. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The sync-templates script copies from .cursor/ (source of truth) into cmd/draft/templates/.cursor/. The previous commit only updated the template copies, not the source. This adds the same draft index/search hooks to the source .cursor/ skills. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…ference detail=none is incompatible with FTS5 trigram tokenizer (trigram matching relies on phrase queries which require detail=full). Also update driver reference from mattn/go-sqlite3 to modernc.org/sqlite to match implementation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Replace flat snippet format with path header + fenced code block using language tag inferred from file extension. Keeps »« match markers and score display. Adds langFromExt helper with 40+ extension mappings. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Include .claude/rules/ and .cursor/rules/ in template sync so draft init installs the draft-search usage guide. Updates findConflicts and sync-templates.sh for both agents. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
draft indexanddraft searchCLI commands with incremental indexing (mtime fast-path + xxh3 hashing)/specand/refineskills, auto-search context into/implementdraft-searchrules for both Claude and Cursor agents, synced viadraft initTest plan
go test ./...— all 45 search tests pass (store, indexer, searcher, project)draft indexon a project, verify incremental re-index is fast (~50ms)draft search "query"and verify markdown fenced output with language tagsdraft initin a fresh directory, verify.claude/rules/draft-search.mdand.cursor/rules/draft-search.mdare created/spec, verifydraft indexruns after spec write/implement, verify search results appear as context🤖 Generated with Claude Code